﻿using System;
using System.Collections.Generic;
using ShopB2C.Entity;
using ShopB2C.Enums;
using ShopB2C.Parameters;

namespace ShopB2C.ViewModels {
    /// <summary>
    /// 评论参数传递类
    /// </summary>
    public class CommentParameters {
        /// <summary>
        /// 每页显示记录数
        /// </summary>
        public int PageSize = 10;
        /// <summary>
        /// 当前页码
        /// </summary>
        public int PageIndex = 1;
        /// <summary>
        /// 总页数
        /// </summary>
        public int PageCount = 1;
        /// <summary>
        /// 总记录数
        /// </summary>
        public int RowsCount = 0;
        /// <summary>
        /// 是评评论还是评论的回复
        /// </summary>
        public CommentType IsReply = CommentType.Comment;
        /// <summary>
        /// 排序字段
        /// </summary>
        public CommentSortFieldNames SortField = CommentSortFieldNames.Newest;
        /// <summary>
        /// 评分
        /// </summary>
        public CommentGradeValues GradeValue = CommentGradeValues.All;
        /// <summary>
        /// 所属的对象 id
        /// </summary>
        public int ProductId = 0;
        /// <summary>
        /// 是否审核
        /// </summary>
        public bool? IsAudit = true;
        /// <summary>
        /// 用户 id
        /// </summary>
        public int Uid = 0;
    }
    /// <summary>
    /// 评论统计
    /// </summary>
    public class CommentCount {
        /// <summary>
        /// 评分名称
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 总评论数
        /// </summary>
        public int Sum { get; set; }
        /// <summary>
        /// 平均评分
        /// </summary>
        public decimal Avg { get; set; }
        /// <summary>
        /// 评分
        /// </summary>
        public int Gv { get; set; }
         /// <summary>
        /// 评分比率
        /// </summary>
        public decimal Gvp { get; set; }
    }
    /// <summary>
    /// 评论
    /// </summary>
    [Serializable]
    public class CommentViewModel {
        /// <summary>
        /// 评论
        /// </summary>
        public CommentEntity Comment { get; set; }
        /// <summary>
        /// 分页实体
        /// </summary>
        public object Pager { get; set; }
        /// <summary>
        /// 分页
        /// </summary>
        public int PageNumber { get; set; }
        /// <summary>
        /// 总记录数
        /// </summary>
        public int RowsCount { get; set; }
        /// <summary>
        /// 评论集合
        /// </summary>
        public List<CommentEntity> CommentList { get; set; }
        /// <summary>
        /// 评论回复集合
        /// </summary>
        public List<CommentEntity> ReCommentList { get; set; }
        /// <summary>
        /// 评论评分列表
        /// </summary>
        public List<CommentCount> CommentCountList { get; set; }
        /// <summary>
        /// 图片路径
        /// </summary>
        public string ImageRoot { get; set; }
        /// <summary>
        /// 用户图标根文件夹
        /// </summary>
        public string UserFaceRoot { get; set; }
        /// <summary>
        /// 商品
        /// </summary>
        public ProductEntity Product { get; set; }
        /// <summary>
        /// 商品参数
        /// </summary>
        public CommentParam CommentParams { get; set; }
        /// <summary>
        /// 排序 url
        /// </summary>
        public Dictionary<CommentSortFieldNames, string> SortDict { get; set; }
        /// <summary>
        /// 评分 url
        /// </summary>
        public Dictionary<CommentGradeValues, string> SearchDict { get; set; }
    }
}
